A view over data. More...
Public Member Functions | |
BufferView () | |
BufferView (T *data, unsigned long long size) | |
BufferView (const Buffer &buffer) | |
BufferView (const Buffer &buffer, unsigned long long index, unsigned long long length) ~BufferView()=default | |
T * | getData () const |
unsigned long long | getSize () const |
bool | empty () const |
T & | front () |
T & | back () |
T & | operator[] (unsigned long long index) |
const T & | operator[] (unsigned long long index) const |
template<typename U > | |
BufferView (BufferCast< U > &bufferCast) | |
BufferView (BufferCast< T > &bufferCast) | |
BufferView (std::vector< T > &vec) | |
A view over data.
Behaves like the BufferCast, but not considered as owner of the memory. This means this variant of the buffer is a good candidate when exchanging data, as it doesn't copy anything but only offers a view over it.
It also allows to cast the data, and alter the way it is intepreted.
nkMemory::BufferView< T >::BufferView | ( | ) |
Default constructor. Creates an empty view.
nkMemory::BufferView< T >::BufferView | ( | T * | data, |
unsigned long long | size | ||
) |
Raw data constructor. This will make the view point to the data provided.
data | The data to point to. |
size | The size of the data provided. |
nkMemory::BufferView< T >::BufferView | ( | const Buffer & | buffer | ) |
Buffer constructor. Offers a view over the data of a buffer.
buffer | The buffer which memory has to be pointed. |
|
default |
Buffer sub-part constructor. Offers a view over a sub-part of a buffer.
buffer | The buffer which memory has to be pointed. |
index | The starting offset, in number of elements T, at which the view should start. |
length | The number of elements T the sub-view should have. Destructor. This variant of the buffer classes will not delete the data pointer on destruction. |
nkMemory::BufferView< T >::BufferView | ( | BufferCast< U > & | bufferCast | ) |
Utility constructor over casts of different type.
bufferCast | The buffer cast which data should be pointed. |
nkMemory::BufferView< T >::BufferView | ( | BufferCast< T > & | bufferCast | ) |
Utility constructor over casts of the same type.
bufferCast | The buffer cast which data should be pointed. |
nkMemory::BufferView< T >::BufferView | ( | std::vector< T > & | vec | ) |
Utility constructor over vectors.
vec | The vector which data should be pointed. |
T* nkMemory::BufferView< T >::getData | ( | ) | const |
unsigned long long nkMemory::BufferView< T >::getSize | ( | ) | const |
bool nkMemory::BufferView< T >::empty | ( | ) | const |
T& nkMemory::BufferView< T >::front | ( | ) |
T& nkMemory::BufferView< T >::back | ( | ) |
T& nkMemory::BufferView< T >::operator[] | ( | unsigned long long | index | ) |
Indexing operator.
index | The index of the element to index in the memory. |
const T& nkMemory::BufferView< T >::operator[] | ( | unsigned long long | index | ) | const |
Indexing operator, const versioned.
index | The index of the element to index in the memory. |